function jianTuan(ev, ok) {
	if($("#requesttuanzhangform").valid() === true) {
		ev.stopPropagation();
		ok = (typeof ok != 'undefined') ? ok : false;
		if (ok) return true;
		$.blockUI({ message: $('#question_jiantuan'), css: { width: '400px',height:'100px',border:'10px solid #999999'} });
		return false;
	}
}
$(document).ready(function() {

        $('#is_student_y').click(function(){
                	$("input[id='university']").prop("disabled", false);
                	$("input[id='xuehao']").prop("disabled", false);
                	$("input[id='xibie']").prop("disabled", false);
                	$("input[id='nianji']").prop("disabled", false);
        });

        $('#is_student_n').click(function(){
                	$("input[id='university']").prop("disabled", true);
                	$("input[id='xuehao']").prop("disabled", true);
                	$("input[id='xibie']").prop("disabled", true);
                	$("input[id='nianji']").prop("disabled", true);
        });

	 $("#requesttuanzhangform").validate({
                rules: {
                        actual_name: {
                                required: true,
                                minlength:2,
                                maxlength:20
                        },
			idno: {
				required: true,
                                minlength:18,
                                maxlength:18
			},
			shouji: {
				required: true,
                                minlength:11,
                                maxlength:11,
				digits:true
			},
			dizhi: {
				required: true,
                                minlength:1,
                                maxlength:100
			},
                        terms: "required"
                },
                messages: {
                        actual_name: {
                                required: "请输入您的真实姓名!",
                                minlength: jQuery.format("请输入最少 {0} 个字符"),
                                maxlength: jQuery.format("姓名最多 {0} 个字符")
                        },
                        idno: {
                                required: "请输入您的身份证号码！",
                                minlength: jQuery.format("请输入{0} 位身份证号码"),
                                maxlength: jQuery.format("请输入{0} 位身份证号码")
                        },
                        dizhi: {
                                required: "请输入您的联系地址",
                                minlength: jQuery.format("地址最少{0} 个字符"),
                                maxlength: jQuery.format("地址最多{0} 个字符")
                        },
                        shouji: {
                                required: "请输入您的手机号码",
                                minlength: jQuery.format("请输入{0} 位手机号"),
                                maxlength: jQuery.format("请输入{0} 位手机号")
                        },
                        terms: "required"
                },
                // the errorPlacement has to take the table layout into account
                errorPlacement: function(error, element) {
                        if ( element.is(":radio") )
                                error.appendTo( element.parent().next().next() );
                        else if ( element.is(":checkbox") )
                                error.appendTo ( element.next() );
                        else
                                error.appendTo( element.parent().next() );
                },
                // set this class to error-labels to indicate valid fields
                success: function(label) {
                        // set &nbsp; as text for IE
                        label.html("&nbsp;").addClass("checked");
                }
        });

	$('#requesttuanzhangform').bind('submit', jianTuan);
	$('#yes_jiantuan').click(function() {
                $('#requesttuanzhangform').trigger('submit', [true]);
                $.blockUI({ message: "<div style=\"margin-left:50px;flaot:left;margin-top:15px;font-size:14px;color:#999999;\">处理中...请不要关闭该页面！</div>" , css:{height:'50px',width:'400px',border:'10px solid #999999'}});
        });

        $('#no_jiantuan').click(function() {
                $.unblockUI();
                return false;
                });



});
